< previous page page_331 next page >

Page 331
z0351-01.gif
Figure 11.7
A straight line fits points smoothly but may
not match the data closely.
Polynomial Curve Fitting
A polynomial is a function of the form F(x) = a0 + a1* x1 + a2* x2 + . . . + aN * xN where the values ai are constants. The degree of a polynomial is the greatest power to which x is raised. The degree in this example is N.
By selecting suitable values for the parameters a0, a1, . . ., aN, you can make a polynomial that fits a collection of points. Using polynomials of different degrees, you can make curves that trade off between a close fit to the data and a smooth curve that does not wiggle around too much. The following sections explain how you can find a linear or quadratic function to fit your data. By generalizing these techniques, you can create data-fitting curves of even higher degree.
Linear Least Squares
The method of least squares fits a curve to a set of data points so that the sum of the squares of the differences between the curve and the data points is as small as possible. If the Y coordinates for the points along the curve are given by the equation y = F(x), and the data values are at position (xi, yi) for 1 <= i <= N, the least squares method tries to minimize the sum:
e10a6a0a59f035e870d90cca05b85fce.gif
E(F(x)) = S (F(xi) - yi)2
z0351-02.gif
Figure 11.8
Fitting points with a curve provides a tradeoff
between smoothness and accuracy.

 
< previous page page_331 next page >